# encoding:utf-8
import pyodbc
def go(path):
	dsn='DRIVER={{MDBToolsODBC}};CHARSET=UTF8;DBQ={path};'.format(path=path)
	conn=pyodbc.connect(dsn)
	conn.setdecoding(pyodbc.SQL_CHAR, encoding='utf-8')
	conn.setdecoding(pyodbc.SQL_WCHAR, encoding='utf-8')
	cur=conn.cursor()
	return cur
def C_T(cur):
	try:
		cur.execute("select CH,ZRZH,LJZH,YSDM,SJC,MYC,CJZMJ,CTNJZMJ,CYTMJ,CGYJZMJ,CFTJZMJ,CBQMJ,CG,SPTYMJ,QXDM from C")
		data=cur.fetchall()
	except Exception,e:
		print "C表读取错误",e
	return data
def H_T(cur):
	try:
		cur.execute("select YSDM,BDCDYH,ZDDM,ZRZH,LJZH,CH,HH,HX,HXJG,ZL,ZCS,SZCC,ZYJZMJ,FTJZMJ,JZMJ,GYTDMJ,FTTDMJ,DYTDMJ,FWLX,FWLXMC,FWXZ,FWXZMC,FWYT1,FWYT2,FWYT3,YTMC,FWPMT,QSLY,ZT,QXDM from H")
		data=cur.fetchall()
	except Exception,e:
		print "H表读取错误",e
	return data
def XZQ_T(cur):
	try:
		cur.execute("select BSM,YSDM,XZQDM,XZQMC,XZQMJ from XZQ")
		data=cur.fetchall()
	except Exception,e:
		print "XZQ表读取错误",e
	return data
def DJQ_T(cur):
	try:
		cur.execute("select BSM,YSDM,DJQDM,DJQMC from DJQ")
		data=cur.fetchall()
	except Exception,e:
		print "DJQ表读取错误",e
	return data
def DJZQ_T(cur):
	try:
		cur.execute("select BSM,YSDM,DJZQDM,DJZQMC from DJZQ")
		data=cur.fetchall()
	except Exception,e:
		print "DJZQ表读取错误",e
	return data
def ZDJBXX_T(cur):
	try:
		cur.execute("select BSM,YSDM,YBZDDM,ZDDM,BDCDYH,ZDTZM,ZL,PZMJ,ZDMJ,QLLX,QLXZ,QLSDFS,PZYT,PZYTMC,SJYT,SJYTMC,TDSYQX,ZDSZD,ZDSZN,ZDSZX,ZDSZB,ZT,ZDT,TFH,DJH,DAH,QSLYZMCL,BZ,QXDM,JZDWSM,YCQZH,ZYQSJXZXSM,QSDCJS,DYC,DCRQ,BDCCLJS,CLR,CLRQ,DCSHR,DCSHRQ,QJDCDW,QJDCFF from ZDJBXX")
		data=cur.fetchall()
	except Exception,e:
		print "ZDJBXX表读取错误",e
	return data
def JZX_T(cur):
	try:
		cur.execute("select ZDDM,YSDM,JZXCD,JZXLB,JZXWZ,JXXZ,QSZYYYSBH,QSZYYYS,QXDM  from JZX")
		data=cur.fetchall()
	except Exception,e:
		print "JZX表读取错误",e
	return data
def JZD_T(cur):
	try:
		cur.execute("select BSM,ZDDM,YSDM,JZDH,SXH,JBLX,JZDLX,XZBZ,YZBZ,QXDM  from JZD")
		data=cur.fetchall()
	except Exception,e:
		print "JZD表读取错误",e
	return data
def ZRZ_T(cur):
	try:
		cur.execute("select BSM,YSDM,BDCDYH,ZDDM,FWZL,ZRZH,JZWMC,FWJGRQ,ZZDMJ,ZYDMJ,JZMJ,FHDJJZMJ,ZCS,DSCS,DXCS,PZYT,PLYTMC,SJYT,SJYTMC,FWJG,FWPMT,DAH,QTGSD,QTGSN,QTGSX,QTGSB,QSLYZMCL,ZT,YCQZH,QXDM,BZ,QSDCJS,DCY,DCRQ,BDCCLJS,CLR,CLRQ,DCSHR,DCHRQ,QJDCDW,QJDCFF from ZRZ")
		data=cur.fetchall()
	except Exception,e:
		print "ZRZ表读取错误",e
	return data
def GZW_T(cur):
	try:
		cur.execute("select BSM,YSDM,BDCDYH,ZDDM,GZWMC,GZWLX,JZJG,ZL,MJ,ZT,DAH,GYTMJ,FTTDMJ,DYTMJ,QXDM  from GZW")
		data=cur.fetchall()
	except Exception,e:
		print "GZW表读取错误",e
	return data
def QLR_T(cur):
	try:
		cur.execute("select YSDM,BDCDYH,SXH,QLRMC,QLRZJZL,QLRZJH,QLRXDH,FDDBRHFZRMC,FDDBRHFZRZJZL,FDDBRHFZRZJH,FDDBRHFZRLXDH,DLRMC,DLRZJZL,DLRZJH,DLRLXDH,SFYBLDJ,CQZH,QZYSXLH,SFCZR,QLLX,FZJG,SSHY,XB,DZ,YB,QLRLX,QLBL,GYFS,GYQK,BZ,QXDM  from QLR")
		data=cur.fetchall()
	except Exception,e:
		print "QLR表读取错误",e
	return data
def LJZ_T(cur):
	try:
		cur.execute("select ZRZH,LJZH,YSDM,MPH,YCJZMJ,YCDXMJ,YCQTMJ,SCJZMJ,SCDXMJ,SCQTMJ,JGRQ,FWJG1,FWJG2,FWJG3,JZWZT,FWYT1,FWYT2,FWYT3,YTMC,ZCS,DSCS,DXCS,BZ,QXDM  from LJZ")
		data=cur.fetchall()
	except Exception,e:
		print "LJZ表读取错误",e
	return data
if __name__=="__main__":
	cur=go("/china.mdb")
	H_T(cur)

